Skip to main content

Incoming Telegram Chat Event

By utilizing this event node, a new workflow instance is started whenever a user initiates a new chat with a Telegram Bot that you have created. Bots are special accounts that a user can chat with. The workflow will be started with certain variables containing information about the chat that you can use to perform additional actions and respond to the user.

Cocosplate AI helps with maintaining the chat contexts with each of the users, while you can establish user interaction with a clear and concise dialog model.

Usage​

Create an event node that triggers for each new chat, handle the messsage issued by the chat e.g. by processing telegram.message_text and send an answer message. After sending a message either put the workflow in dormant state

  1. Leave the workflow via a final node.

    With this approach the chat with the particular ID is still known and the next message will wake trigger the workflow with the same context.

  2. Alternatively use the wakeup timer to put the workflow dormant.

    This way a timeout can be defined that terminates the chat after a certain time of inactivity by visiting an end node. Note that the workflow will continue at the scheduled timer node since it was put dormant there.

Variables​

These values are automatically set when a new chat is started:

VariableDescription
telegram.message_textThe text that was sent to the bot
telegram.chat_idChat identifier
telegram.api_tokenToken of the bot
telegram.message_from_usernameThe user that initiated the chat
telegram.message_from_firstnameFirst name
telegram.message_from_lastnameLast name
telegram.message_from_languagecodeLanguage of the user
telegram.message_from_isbotWhether the user itself is a bot

See also Telegram Chat for documentation on sending an answering message.